package com.xuecheng.system.convert;

import com.xuecheng.api.system.model.dto.CourseCategoryDTO;
import com.xuecheng.system.entity.ext.CourseCategoryNode;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * <p></p>
 *
 * @Description:
 */

@Mapper
public interface CourseCategoryConvert {

    CourseCategoryConvert INSTANCE = Mappers.getMapper(CourseCategoryConvert.class);

    /**
     * 单个数据转换dto
     *
     * @param node
     * @return
     */
    @Mappings({
            @Mapping(source = "id",target = "courseCategoryId"),
            @Mapping(source = "childrenTreeNodes",target = "categoryTreeNodes")
    })
    CourseCategoryDTO node2dto(CourseCategoryNode node);

    /**
     * 集合数据转换dto
     * @param nodes
     * @return
     */
    List<CourseCategoryDTO> nodes2dtos(List<CourseCategoryNode> nodes);

}
